<template>
	<keep-alive>
	<view>
		<view class="record">
		<text  class="tab" :class="cunt == index? 'nac':''" v-for="(item,index) in tab" :key='index' @tap="infos(index)">
			{{item}}
		</text>
		</view>
		<view class="record_box" v-if="cunt ==0">
			<view class="one_records">
					<view class="record_name cfff">币种名称</view>
					<view class="record_time cfff">时间</view>
					<view class="cfff">金额 SMK</view>
					<view class="record_time cfff">收益金额 </view>
						<view class="record_time cfff">结算状态 </view>
			</view>
	
			<view class="one_record" v-for="(val,index) in applyData" :key='val.id'>
				
					<view class="record_name cfff">{{val.currency}}</view>
					<view class="record_time cfff">{{val.buy_time /1000 | birtime }}</view>
					<view class="cfff">{{val.buy_money | toTwo(4)}} SMK</view>
					<view class="record_time cfff">{{val.profit_money | toTwo(4)}} </view>
					<view class="record_time cfff">{{val.status == 0? '未结算':'已结算' }} </view>
			</view>
			
<!-- 			<view class="one_record">
				<view class="aside_left">
					<view class="record_name">划转</view>
					<view class="record_time">2020-04-18 18:16:46</view>
				</view>
				<view class="aside_right reduce">-1000.24 BEH</view>
			</view> -->
			
		</view>
		
		<view v-if="cunt == 1" class="zhuanzhang set_border" v-for="(val,index) in consumeRecordLists" :key="'info2-'+index"  @tap="$open('../bizhan/ore_info?id='+val.mm_id)"  >
			<view class="aside_top">
				<view class="left">{{val.type_name}}</view>
				<view class="right ">
					<!-- <text>-</text> -->
				
					{{val.mining_amount | toTwo(4)}}
				</view>
			</view>
			<view class="aside_bot">
				<!--  -->
				<view class="date left">{{` ${val.pur_time.substr(4,2)}-${val.pur_time.substr(6,2)} ${val.pur_time.substr(8,2)}:${val.pur_time.substr(10,2)}`}}</view>
			</view>
		</view>
		
		<view v-if="cunt == 2" class="zhuanzhang set_border" v-for="(val,index) in yewu" :key="'info2-'+index"  @tap="$open('../bizhan/ore_info?id='+val.mm_id)"  >
			<view class="aside_top">
				<view class="left">{{val.amount}} SMK</view>
				<view class="right ">
		
					{{
				` ${val.create_time.substr(0,2)}-${val.create_time.substr(4,2)}-${val.create_time.substr(6,2)}
				`
					}}
				</view>
			</view>
			<view class="aside_bot">
				<!-- {{` ${val.pur_time.substr(4,2)}-${val.pur_time.substr(6,2)} ${val.pur_time.substr(8,2)}:${val.pur_time.substr(10,2)}`}} -->
				<view class="date left"></view>
			</view>
		</view>
		
		<view v-if="cunt == 3" class="zhuanzhang set_border" v-for="(val,index) in fenhong" :key="'info2-'+index"  @tap="$open('../bizhan/ore_info?id='+val.mm_id)"  >
			<view class="aside_top">
				<view class="left">{{val.amount}}</view>
				<view class="right ">
				
				
					{{` ${val.create_time.substr(0,2)}-${val.create_time.substr(4,2)}-${val.create_time.substr(6,2)}
				`}}
				</view>
			</view>
			
		</view>
		
	</view>
	</keep-alive>
</template>

<script>
	export default {
		data() {
			return {
				applyData:{},
			tab:['合约明细','挖矿明细','业绩佣金','业绩分红'],
			cunt:0,
			consumeRecordLists:[],
				// page:1
			yewu:[],
			fenhong:[]
			}
		},
	onNavigationBarButtonTap(){
			window.location.reload()
		},
	
		onShow() {
			// this.page=1
			// this.applyData=[]
			this.getPoolWalletLog()
			this.getMoney();
		},
		// onReachBottom() {
		// //	this.page++
		// 	this.getPoolWalletLog()
		// },
		methods: {
			getPoolWalletLog(){
				// this.$ajax('bi/getPoolWalletLog',{
				// 	userId:uni.getStorageSync('userinfo').userId,
				// 	page:this.page
				// },"POST").then(res => {
				// 	this.applyData=this.applyData.concat(res.data)
				// });
				
				
				this.$ajax(
				this.apiList.BiInfo
				,{
					userId:uni.getStorageSync('userinfo').userId
				
				},
				).then(res => {
					this.applyData = res.data
		
				});
			},
			getMoney(){
				this.$ajax(
				'/bi/getMineMining',
				{
				userId:uni.getStorageSync('userinfo').userId
				
				},
				'POST'
				).then(res=>{
				this.consumeRecordLists = res.data
				})
				//业绩佣金
				this.$ajax(
				'bi/companyAchievementAllocation',
				{
					userId:uni.getStorageSync('userinfo').userId,
						flag: 10 //10流水佣金
				},
				"POST",
				).then(res=>{
					this.yewu = res.data
				})
				//业绩分红
				this.$ajax(
				'bi/companyAchievementAllocation',
				{
					userId:uni.getStorageSync('userinfo').userId,
						flag: 30 //30业绩分红
				},
				"POST",
				).then(res=>{
					this.fenhong = res.data
					console.log(res)
				})
			},
			
			
			infos(index){
				this.cunt = index
			}
		},
		filters:{
			type(value){
				if(value==1){
					return '矿池划转钱包帐户'
				}else if(value==2){
					return '钱包划转矿池帐户'
				}else if(value==3){
					return '兑换算力'
				}else if(value==4){
					return '挖矿收益'
				}else if(value==5){
					return '节点奖励'
				}else if(value==6){
					return '邀请奖励'
				}else if(value==7){
					return '注册赠送'
				}else{
					return '其他'
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #0E1B45;
	}
	
	.record {
		width: 100%;
		box-sizing: border-box;
		text-align: center;
		margin-bottom: 10upx;
	}
	.tab{
		display: inline-block;
		width: 24%;
		height: 44px;
		background-color: rgba(95,104,114,0.43);
		margin-top: 20upx;
		color: #fff;
		text-align: center;
		line-height: 44px;
	}
	.nac {
		background: #ff3a2f;
	}
	
	.zhuanzhang {
		height: 140rpx;
	}
	
	.set_border {
		border-bottom: 1px solid #20D6D9;
		padding-left: 20upx;
	}
	.aside_top {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		font-size: 30rpx;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		padding-top: 29rpx;
	}
	.left{
		color: #FFF;
	}
	.right {
		margin-right: 23rpx;
		color: #FFF;
	}
	
	.date {
		margin-right: 10rpx;
	}
	
	
	
	
.one_record{
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	padding-right: 32rpx;
	border-bottom: 1rpx solid #20D6D9;
	margin-left: 30rpx;
	height: 134rpx;
}
.one_records {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	padding-right: 32rpx;
	border-bottom: 1rpx solid #20D6D9;
	margin-left: 30rpx;
}
.record_name{
	font-size:30rpx;
	line-height: 30rpx;
	color:rgba(51,51,51,1);
}
.record_time{
	font-size:30rpx;
	line-height: 30rpx;
	color:rgba(51,51,51,1);
}
.aside_right{
	font-size:30rpx;
	line-height: 30rpx;	
	text-align: right;
	view{
		padding: 6rpx 0;
	}
}
.add{
	color:rgba(255,166,30,1);
}
.reduce{
	color:rgba(51,51,51,1);
}
</style>
